package com.hengpeng.itfin.domain.imprest;

import com.hengpeng.itfin.domain.imprest.alipay.AlipayAndriodImprestProcessor;
import com.hengpeng.itfin.domain.imprest.alipay.AlipayAndriodNewImprestProcessor;
import com.hengpeng.itfin.domain.imprest.alipay.AlipayImprestProcessor;
import com.hengpeng.itfin.domain.imprest.alipay.AlipayWapImprestProcessor;
import com.hengpeng.itfin.service.ServiceFactory;
import com.hengpeng.itfinbase.persist.PaymentProvider;

public class ImprestProcessorFactory
{
	public static ImprestProcessor getProcessor(ServiceFactory serviceFactory, PaymentProvider provider)
	{
		ImprestProcessor processor = null;
		switch (provider.getGatewayType())
		{
			case PAY_ALIPAY_NET:
				processor = new AlipayImprestProcessor(serviceFactory, provider);
				break;
			case PAY_ALIPAY_WAP:
				processor = new AlipayWapImprestProcessor(serviceFactory, provider);
				break;
			case PAY_ALIPAY_ANDRIOD:
				processor = new AlipayAndriodImprestProcessor(serviceFactory, provider);
				break;
			case PAY_ALIPAY_AND_NEW:
				processor = new AlipayAndriodNewImprestProcessor(serviceFactory, provider);
				break;
			default:
				throw new RuntimeException("不存在的支付提供商处理器");
		}
		return processor;
	}
}
